package com.smmisia.shop.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.Getter;

@Getter
public enum TicketTypeEnum {

    SCENIC_AREA_TICKET(0, "景区票"),
    SCENIC_SPOT_TICKET(1, "景点票");

    @EnumValue
    private Integer code;
    private String desc;

    TicketTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static TicketTypeEnum getTicketTypeEnum(Integer code) {
        for (TicketTypeEnum ticketTypeEnum : TicketTypeEnum.values()) {
            if (ticketTypeEnum.getCode().equals(code)) {
                return ticketTypeEnum;
            }
        }
        return null;
    }
}
